package com.boot.customer.controller;

import com.boot.customer.pojo.Customer;
import com.boot.customer.service.CustomerService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/")
public class CustomerController {

    @Autowired
    private CustomerService customerService;

    @GetMapping("list")
    public List<Customer> list(){
        log.info("controller------查询用户");
        return this.customerService.findAll();
    }

    @GetMapping("find/{id}")
    public Customer findById(@PathVariable(name = "id") String id){
        log.info("controller------查询用户");
        //000ed526e23b41c4927345a460bc3b04
        return this.customerService.findById(id);
    }
}
